package com.example.myapplication.dao;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import com.example.myapplication.entity.Note;

import java.util.List;
//针对Note这个实体的操作的接口的方法
@Dao
public interface NoteDao {
    //第一步 查询
    @Query("SELECT * FROM note_table ORDER BY id DESC")
    LiveData<List<Note>> getAllNotes();
    //第二步 插入
    @Insert
    void insert(Note note);
    @Delete
    void delete(Note note);

}
